//
//  SYContractsCell.m
//  ChatDemo-UI2.0
//
//  Created by zz on 16/6/11.
//  Copyright © 2016年 zz. All rights reserved.
//

#import "SYContractsCell.h"

@implementation SYContractsCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        UIView *superView = self.contentView;
        
        _selectimg=[[UIImageView alloc]initWithFrame:CGRectMake(12, 17, 18, 18)];
        [superView addSubview:_selectimg];
        
        _headView = [[XZHeaderImageView alloc] initWithFrame:CGRectMake(_selectimg.frame.origin.x+_selectimg.frame.size.width+15, 7, 38, 38)];
        [superView addSubview:_headView];
        
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(_headView.frame.origin.x+_headView.frame.size.width +10, 15, 200, 22)];
        _nameLabel.font = [UIFont systemFontOfSize:13];
        _nameLabel.textColor=RGBACOLOR(59, 59, 59, 1);
        [superView addSubview:_nameLabel];
        
        _courseLabel=[[UILabel alloc]initWithFrame:CGRectMake(12, 19, SCREENWIDTH-24, 14)];
        _courseLabel.hidden=YES;
        _courseLabel.font=[UIFont systemFontOfSize:14];
        _courseLabel.textColor=RGBACOLOR(151, 151, 151, 1);
        _courseLabel.textAlignment=NSTextAlignmentRight;
        [self.contentView addSubview:_courseLabel];
        
        _line=[[UIView alloc]initWithFrame:CGRectMake(_nameLabel.frame.origin.x, 51.5, SCREENWIDTH-_nameLabel.frame.origin.x, 0.5)];
        _line.backgroundColor=RGBACOLOR(199, 199, 204, 1);
        [superView addSubview:_line];
        
        _lLine=[[UIView alloc]initWithFrame:CGRectMake(0, 51.5, SCREENWIDTH, 0.5)];
        _lLine.backgroundColor=RGBACOLOR(199, 199, 204, 1);
        _lLine.hidden = YES;
        [superView addSubview:_lLine];
        
        _headerLongPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(headerLongPress:)];
        _headerLongPress.enabled=NO;
        [self addGestureRecognizer:_headerLongPress];
        
        
    }
    
    return self;
}
- (void)headerLongPress:(UILongPressGestureRecognizer *)longPress
{
    if (longPress.state == UIGestureRecognizerStateBegan) {
        if(_delegate && _indexPath && [_delegate respondsToSelector:@selector(cellImageViewLongPressAtIndexPath:)])
        {
            [_delegate cellImageViewLongPressAtIndexPath:self.indexPath];
        }
    }
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
